package com.thoughtworks.android.androsphere.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.thoughtworks.android.androsphere.R;

public class MessageActivity extends Activity {
    private static final String TAG = MessageActivity.class.getName();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent invokingIntent = getIntent();
        String title = (String) invokingIntent.getExtras().get("title");
        String  text = (String) invokingIntent.getExtras().get("text");

        setContentView(R.layout.message);

        getWindow().setLayout(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        TextView titleView = (TextView) findViewById(R.id.title);
        titleView.setText(title);

        TextView textView = (TextView) findViewById(R.id.text);
        textView.setText(text);
        textView.setMovementMethod(new ScrollingMovementMethod());

        findViewById(R.id.reply).setOnClickListener(new View.OnClickListener(){

            public void onClick(View view) {
                startActivityForResult(new Intent(view.getContext(), ComposeMessageActivity.class),0);
            }
        });

        Log.d(TAG, title + " : " + text);
    }
}
